package simple.form.controller;

import com.sun.deploy.cache.CacheEntry;
import simple.form.cache.Cache;
import simple.form.cache.CacheManager;
import simple.form.cache.Key;
import simple.form.core.RequestBean;

/**
 * 基础Controller
 * Created by Administrator on 2017/2/23.
 */
public class BaseController {

    /**
     * 解析form请求参数
     * @param requestBean
     * @return
     */
    public RequestBean pareBean(RequestBean requestBean){
        RequestBean.parse(requestBean);
        return  requestBean;

    }

    /**
     * 获取缓存
     * @param key
     * @return
     */
    public Cache getCache(Key key){
        return CacheManager.getCache(key);
    }

    /**
     * 添加缓存
     * @param key
     * @param cache
     * @return
     */
    public Cache addCache(Key key,Cache cache){
        CacheManager.addCache(key,cache);
        return   cache;
    }
}
